package com.company.service.impl;

import com.company.entity.User;
import com.company.service.LoginService;

import java.util.List;
import java.util.Scanner;

public class LoginServiceImpl implements LoginService {

    @Override
    public void execute(List list) {
        while (true){



            Scanner sc = new Scanner(System.in);
            System.out.println("请输入姓名：");
            String name = sc.next();
            System.out.println("请输入密码：");
            String pwd = sc.next();
            for (int i = 0; i < list.size(); i++) {

                User user=(User) list.get(i);
                if (name.equals(user.getUsername()) && pwd.equals(user.getPassword())){
                    System.out.println("登录成功");


                    break;
                }else{
                    System.out.println("失败");
                }

            }
            break;

        }
    }
}
